<?php
function datetime() {
    return date('Y-m-d H:i:s');
}

function order_sn(){
    return date('YmdHis').rand(10000, 99999);
}

function str_rand($length = 32, $char = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ') {
    if(!is_int($length) || $length < 0) {
        return false;
    }

    $string = '';
    for($i = $length; $i > 0; $i--) {
        $string .= $char[mt_rand(0, strlen($char) - 1)];
    }

    return strtoupper($string);
}
